const express = require("express")

const app = express();

app.set("secret", "^_^")

//跨域模块要配置到所有组件之前
//跨域模块
const cors = require('cors');
app.use(cors());

//解析json文件 
app.use(express.json())

//数据库
require("./plugins/db")(app)

//路由
require("./router/index")(app)

//挂载静态主页
app.use("/backPlatform", express.static(__dirname + "/backPlatform"));

app.listen(3000, () => {
    console.log("server is running at http://localhost:3000");
})